package {
	import flash.display.*;
	import flash.events.*;
	import utils.common.global.*;
	import utils.common.time.AccurateTimer;
	
	/**
	 * ...
	 * @author Aleksey Trufanov
	 */
	public class Main extends Sprite {
		// for AccurateTimer example
		private var _PlayTime:Number = 0;
		private var _time:AccurateTimer = new AccurateTimer();
		
		public function Main():void {
			if ( stage ) {
				init();
			} else {
				addEventListener( Event.ADDED_TO_STAGE, init );
			}
		}
		
		private function init( e:Event=null ):void {
			removeEventListener( Event.ADDED_TO_STAGE, init );
			
			// Example of usage AccurateTimer class:
			addEventListener( Event.ENTER_FRAME, UpdateMain );			
		}
		
		private function UpdateMain( e:Event ) { // Update delta time
			_time.Update();
			Update( _time.getDT() );
	    }
		
		private function Update( dt:Number ):void {
			_PlayTime += dt;
			trace(" _PlayTime: " + int( _PlayTime ) ); // display seconds
		}
		
	}
}